Skip to content

feat:Update OpenAPI spec for image creation, model inputs, and event schemas#190

Merged
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202507151826
Jul 15, 2025
Merged

feat:Update OpenAPI spec for image creation, model inputs, and event schemas#190
HavenDV merged 1 commit intomainfrom
bot/update-openapi_202507151826

Conversation

@HavenDV
Copy link
Copy Markdown
Contributor

@HavenDV HavenDV commented Jul 15, 2025

Summary by CodeRabbit

  • New Features

    • Expanded support for model inputs to include both text and image objects, allowing more flexible input options.
    • Added a new "in progress" status for conversation items.
  • Improvements

    • Image creation endpoints now return a single image object instead of a list, clarifying the response format.
    • Updated event details to allow certain fields to be null when no previous item exists, improving data clarity.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jul 15, 2025

Walkthrough

The OpenAPI specification was updated to refine image creation endpoint responses, expand model input schemas to support both text and image inputs, add a new "in_progress" status to conversation items, and adjust event schemas to allow nullable previous_item_id fields with clarified descriptions.

Changes

File(s) Change Summary
src/libs/tryAGI.OpenAI/openapi.yaml Updated image endpoint return descriptions; expanded model input schemas for images; added "in_progress" to status enum; made previous_item_id nullable and updated related event schemas.

Sequence Diagram(s)

sequenceDiagram
    participant Client
    participant API

    Client->>API: POST /image/generate or /image/edit
    API-->>Client: Returns an image object

    Client->>API: Send model input (text, image, or array of both)
    API-->>Client: Processes input accordingly

    API->>Client: Event with conversation item status (including "in_progress")
    API-->>Client: Event with nullable previous_item_id
Loading

Poem

A schema refined, with images in tow,
Now text and pictures together can flow.
Status "in_progress" joins the conversation,
While nullable links grant new foundation.
The endpoints respond with clarity bright—
A rabbit hops on, coding delight! 🐇

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bot/update-openapi_202507151826

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@HavenDV HavenDV enabled auto-merge (squash) July 15, 2025 18:27
@HavenDV HavenDV merged commit b842dc2 into main Jul 15, 2025
3 of 4 checks passed
@HavenDV HavenDV deleted the bot/update-openapi_202507151826 branch July 15, 2025 18:31
@coderabbitai coderabbitai Bot changed the title feat:@coderabbitai feat:Update OpenAPI spec for image creation, model inputs, and event schemas Jul 15, 2025
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between eb4abaf and 0281f5a.

⛔ Files ignored due to path filters (17)
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI..JsonSerializerContext.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant3Type.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant3TypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant4Type.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonConverters.EvalItemContentVariant4TypeNullable.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.JsonSerializerContextTypes.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItem.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant3Type.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4.Json.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.EvalItemContentVariant4Type.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeConversationItemWithReference.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeConversationItemWithReferenceStatus.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeServerEventConversationItemCreated.g.cs is excluded by !**/generated/**
  • src/libs/tryAGI.OpenAI/Generated/tryAGI.OpenAI.Models.RealtimeServerEventInputAudioBufferCommitted.g.cs is excluded by !**/generated/**
📒 Files selected for processing (1)
  • src/libs/tryAGI.OpenAI/openapi.yaml (6 hunks)
🔇 Additional comments (1)
src/libs/tryAGI.OpenAI/openapi.yaml (1)

18069-18074: Verify downstream handling of new in_progress status

Adding in_progress is fine here, but please confirm all services, SDKs, and DB enum constraints accept the new value to avoid runtime rejections.

group: images
name: Create image
returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'
returns: 'Returns an [image](/docs/api-reference/images/object) object.'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Same mismatch for /images/generations

Replicate the fix above to keep both endpoints aligned.

-        returns: 'Returns an [image](/docs/api-reference/images/object) object.'
+        returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml at line 2518, there is a mismatch issue
for the /images/generations endpoint similar to the one fixed previously. Review
the previous fix applied to the other endpoint and replicate the same
corrections here to ensure both endpoints are consistent and aligned in their
definitions.

group: images
name: Create image edit
returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'
returns: 'Returns an [image](/docs/api-reference/images/object) object.'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Return description now contradicts the response structure

The example payload still wraps the image(s) in a data array, yet the returns line was changed from “list of image objects” to a singular “image object”. This breaks consistency with both the payload and existing client expectations.

-        returns: 'Returns an [image](/docs/api-reference/images/object) object.'
+        returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
returns: 'Returns an [image](/docs/api-reference/images/object) object.'
returns: 'Returns a list of [image](/docs/api-reference/images/object) objects.'
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml at line 2485, the return description
states a singular "image object" but the example payload and client expectations
use a list of image objects wrapped in a `data` array. Update the return
description to indicate a list of image objects to match the example payload and
maintain consistency.

Comment on lines +12877 to +12880
detail:
type: string
description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"
image_url:
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Constrain detail to its documented enum

Since the description limits detail to high | low | auto, encoding that in the schema helps validation and client generation.

-                detail:
-                  type: string
-                  description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"
+                detail:
+                  type: string
+                  enum: [high, low, auto]
+                  default: auto
+                  description: "Detail level of the image sent to the model."\n
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
detail:
type: string
description: "The detail level of the image to be sent to the model. One of `high`, `low`, or `auto`. Defaults to `auto`.\n"
image_url:
detail:
type: string
enum: [high, low, auto]
default: auto
description: "Detail level of the image sent to the model."
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 12877 to 12880, the `detail`
field should be constrained to the enum values `high`, `low`, and `auto` as per
its description. Update the schema definition for `detail` to include an enum
property listing these three allowed string values. This will enforce validation
and improve client code generation by clearly specifying the permitted values.

Comment on lines +12890 to +12893
- title: An array of Input text and Input image
type: array
description: "A list of inputs, each of which may be either an input text or input image object.\n"
description: "Inputs to the model - can contain template strings.\n"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

type: array without items makes the schema invalid

OpenAPI requires an items field for arrays. Without it, tools such as Swagger-UI and openapi-generator will fail.

-            - title: An array of Input text and Input image
-              type: array
-              description: "A list of inputs, each of which may be either an input text or input image object.\n"
+            - title: An array of Input text and Input image
+              type: array
+              description: "A list of inputs, each of which may be either an input text or input image object.\n"
+              items:
+                oneOf:
+                  - $ref: '#/components/schemas/Input text'
+                  - $ref: '#/components/schemas/Input image'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- title: An array of Input text and Input image
type: array
description: "A list of inputs, each of which may be either an input text or input image object.\n"
description: "Inputs to the model - can contain template strings.\n"
- title: An array of Input text and Input image
type: array
description: "A list of inputs, each of which may be either an input text or input image object.\n"
items:
oneOf:
- $ref: '#/components/schemas/Input text'
- $ref: '#/components/schemas/Input image'
🤖 Prompt for AI Agents
In src/libs/tryAGI.OpenAI/openapi.yaml around lines 12890 to 12893, the schema
defines a type as array but is missing the required items field. To fix this,
add an items property specifying the type or schema of the array elements to
make the OpenAPI schema valid and compatible with tools like Swagger-UI and
openapi-generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant